package com.design_mode;

/**
 * Created by dustaple on 8/4/14.
 */
public class DecoratorPattern {

    public static void main(String[] args) {
        SomeOne one = new Man();
        one = new ShemaleA(one);
        one.gender();
        one.sexCharacter();
    }
}

abstract class SomeOne {
    public abstract void gender();

    public abstract void sexCharacter();
}

class Man extends SomeOne {

    @Override
    public void gender() {
        System.out.println("男");
    }

    @Override
    public void sexCharacter() {
        System.out.println("有喉节,没咪咪，腿上毛多。");
    }
}

abstract class Shemale extends SomeOne {
    SomeOne someOne;

    protected Shemale(SomeOne someOne) {
        this.someOne = someOne;
    }

    @Override
    public void gender() {
        someOne.gender();
    }

    @Override
    public void sexCharacter() {
        someOne.sexCharacter();
    }
}

class ShemaleA extends Shemale {
    protected ShemaleA(SomeOne someOne) {
        super(someOne);
    }

    @Override
    public void gender() {
        super.gender();
        System.out.println("可以扮女人");
    }

    @Override
    public void sexCharacter() {
        //super.sexCharacter();
        System.out.println("没喉节（雌性激素药吃的）,有咪咪（馒头做）,没腿毛（拔的）.");
    }
}